<!--
  @Created by pangzg pangzg2@yusys.com.cn on 2020-3-31 14:22:49.
  @updated by
  @description 任务列表清单
-->
<div>


	<yu-panel title="事件信息">
		<yu-tabs v-model="taskList">
			<yu-tab-pane label="当前作业清单" name="currentList">
				<el-form-q ref="queryJobRef" :field-data="queryFields" :buttons="queryButtons" class="task-query-form"></el-form-q>
				<yu-toolBar>
					<yu-button v-if="infoBnt" @click="infoFn">详情</yu-button>
					<yu-button v-if="reloadDataBnt" @click="reloadData">刷新</yu-button>
					<yu-button v-if="showFlowChartBnt" @click="showFlowChart('N')">作业流信息</yu-button>
					<yu-button v-if="redoBnt" @click="redoRunTask">重跑</yu-button>
					<yu-button v-if="interruptBnt" @click="interruptFlowChart">中断</yu-button>
					<yu-button v-if="forceSuccessBnt" @click="forceJobSuccess">强制成功</yu-button>
					<yu-button v-if="preValueBnt" @click="preValue">查看设置预置返回值</yu-button>
					<yu-button v-if="unPreValueBnt" @click="unPreValue">取消预置返回值</yu-button>
					<yu-button v-if="forceJobValueBnt" @click="forceJobValue">强制设置返回值</yu-button>
					<yu-button v-if="jobParamBnt" @click="jobParamClick">作业信息调整</yu-button>
					<yu-button v-if="jobPriorBnt" @click="jobPriorClick">优先级</yu-button>
				</yu-toolBar>
				<div ref="tableBox" style="overflow: auto;">
					<yu-xtable :height="tbHeight" ref="refTable" row-number :data-url="dataUrl" selection-type="checkbox" @row-dblclick="showJobInfo"
					 @row-click="cellClick" :default-load="false" :base-params="baseParams">
						<yu-xtable-column label="应用系统" prop="appName" :sortable="true" :show-overflow-tooltip="true" width="100px"></yu-xtable-column>
						<yu-xtable-column label="任务号" prop="cycleNo" :sortable="true" :show-overflow-tooltip="true" width="100px"></yu-xtable-column>
						<yu-xtable-column label="任务名称" prop="groupName" :sortable="true" :show-overflow-tooltip="true" width="100px"></yu-xtable-column>
						<yu-xtable-column label="作业代码" prop="actionCode" :sortable="true" :show-overflow-tooltip="true" width="100px"></yu-xtable-column>
						<yu-xtable-column label="作业名称" prop="actionName" :sortable="true" :show-overflow-tooltip="true" width="100px"></yu-xtable-column>
						<yu-xtable-column label="周期时点" prop="cyclePnt" :sortable="true" width="100px"></yu-xtable-column>
						<yu-xtable-column label="任务状态" prop="runState" :sortable="true" data-code="USE_TASK_RUN_STATE,USE_JOB_RUN_STATE" width="100px"></yu-xtable-column>
						<yu-xtable-column label="作业状态" prop="jobState" :options="jobStateOptions"></yu-xtable-column>
						<yu-xtable-column label="开始时间" prop="enterTimeStr" width="200" :show-overflow-tooltip="true"></yu-xtable-column>
						<yu-xtable-column label="开始运行时间" prop="beginTimeStr" width="200" :show-overflow-tooltip="true"></yu-xtable-column>
						<yu-xtable-column label="总时长" prop="runningTime"></yu-xtable-column>
						<yu-xtable-column label="运行时长" prop="actualRunningTime"></yu-xtable-column>
						<yu-xtable-column label="代理节点码" prop="agentCode" width="100px"></yu-xtable-column>
					</yu-xtable>
				</div>
			</yu-tab-pane>
			<yu-tab-pane label="历史作业清单" name="hisList">
				<el-form-q ref="queryJobRefHis" :field-data="queryFieldsHis" :buttons="queryButtonsHis" class="task-query-form"></el-form-q>
				<yu-toolBar>
					<yu-button v-if="infoBnt" @click="infoFn">详情</yu-button>
					<yu-button v-if="reloadDataBnt" @click="reloadDataHis">刷新</yu-button>
					<yu-button v-if="showFlowChartBnt" @click="showFlowChart('Y')">作业流信息</yu-button>
				</yu-toolBar>
				<div ref="tableBoxHis" style="overflow: auto;">
					<yu-xtable :height="tbHeight" ref="refTableHis" row-number :data-url="dataUrlHis" selection-type="checkbox" @row-dblclick="showJobInfo"
					 @row-click="cellClick" :default-load="false" :base-params="baseParams">
						<yu-xtable-column label="应用系统" prop="appName" :sortable="true" :show-overflow-tooltip="true" width="100px"></yu-xtable-column>
						<yu-xtable-column label="任务号" prop="cycleNo" :sortable="true" :show-overflow-tooltip="true" width="100px"></yu-xtable-column>
						<yu-xtable-column label="任务名称" prop="groupName" :sortable="true" :show-overflow-tooltip="true" width="100px"></yu-xtable-column>
						<yu-xtable-column label="作业代码" prop="actionCode" :sortable="true" :show-overflow-tooltip="true" width="100px"></yu-xtable-column>
						<yu-xtable-column label="作业名称" prop="actionName" :sortable="true" :show-overflow-tooltip="true" width="100px"></yu-xtable-column>
						<yu-xtable-column label="周期时点" prop="cyclePnt" :sortable="true" width="100px"></yu-xtable-column>
						<yu-xtable-column label="任务状态" prop="runState" :sortable="true" data-code="USE_TASK_HIS_RUN_STATE" width="100px"></yu-xtable-column>
						<yu-xtable-column label="作业状态" prop="jobState" :options="jobStateOptions"></yu-xtable-column>
						<yu-xtable-column label="开始时间" prop="enterTimeStr" width="200" :show-overflow-tooltip="true"></yu-xtable-column>
						<yu-xtable-column label="开始运行时间" prop="beginTimeStr" width="200" :show-overflow-tooltip="true"></yu-xtable-column>
						<yu-xtable-column label="总时长" prop="runningTime"></yu-xtable-column>
						<yu-xtable-column label="运行时长" prop="actualRunningTime"></yu-xtable-column>
					</yu-xtable>
				</div>
			</yu-tab-pane>

		</yu-tabs>
	</yu-panel>


	<yu-xdialog title="作业信息" :visible.sync="visible" width="75%" element-loading-text="数据处理中">
		<yu-tabs type="border-card" v-model="tabsActiveName" v-loading="loading">
			<yu-tab-pane label="作业基本信息">
				<yu-xform ref="refBaseForm" v-model="baseFormData" class="formHeight" label-width="140px">
					<yu-xform-group>
						<yu-xform-item label="作业类型名称" ctype="select" data-code="USE_TASK_JOB_TYPE" name="typeCode" :disabled="true"></yu-xform-item>
						<yu-xform-item label="作业代码" ctype="input" name="actionCode" :disabled="true"></yu-xform-item>
						<yu-xform-item label="作业名称" ctype="input" name="actionName" :disabled="true"></yu-xform-item>
						<yu-xform-item label="作业编号" ctype="input" name="sequence" :disabled="true"></yu-xform-item>
						<yu-xform-item label="返回值" ctype="input" name="retValue" :disabled="true"></yu-xform-item>
						<yu-xform-item label="集群代理名称" ctype="select" name="agentCode" :options="agentIds" :disabled="!updateFlag"></yu-xform-item>
						<yu-tooltip class="item" effect="light" content="执行内容(atr)：执行内容变量替换前" placement="top-start">
							<yu-xform-item label="执行内容(atr)" name="actionExec" ctype="input" :disabled="!updateFlag"></yu-xform-item>
						</yu-tooltip>
						<yu-tooltip class="item" effect="light" content="执行位置(atr)：执行位置变量替换前" placement="top-start">
							<yu-xform-item label="执行位置(atr)" name="actionLoc" ctype="input" :disabled="!updateFlag"></yu-xform-item>
						</yu-tooltip>
						<yu-tooltip class="item" effect="light" content="执行内容(wrk)：执行内容变量替换后" placement="top-start">
							<yu-xform-item label="执行内容(wrk)" name="actionExecWrk" ctype="input" :disabled="true" v-if="!(taskList=='hisList')"></yu-xform-item>
						</yu-tooltip>
						<yu-tooltip class="item" effect="light" content="执行位置(wrk)：执行位置变量替换后" placement="top-start">
							<yu-xform-item label="执行位置(wrk)" name="actionLocWrk" ctype="input" :disabled="true" v-if="!(taskList=='hisList')"></yu-xform-item>
						</yu-tooltip>
						<yu-xform-item label="执行结果" name="jobStateStr" ctype="input" :disabled="true"></yu-xform-item>
						<yu-xform-item label="开始时间" name="beginTimeStr" ctype="input" :disabled="true"></yu-xform-item>
						<yu-xform-item label="结束时间" name="endTimeStr" ctype="input" :disabled="true"></yu-xform-item>
						<yu-xform-item label="历史平均执行时长" name="hisAvgTimeStr" ctype="input" :disabled="true"></yu-xform-item>
						<yu-xform-item label="作业优先级" name="actionPrior" ctype="num" :disabled="!updateFlag"></yu-xform-item>
					</yu-xform-group>
				</yu-xform>
			</yu-tab-pane>
			<yu-tab-pane label="作业参数信息" v-if="!updateFlag">
				<yu-xtable selection-type="checkbox" ref="refTableExec" :pageable="false" height="410px" :data="wftParList">
					<yu-xtable-column prop="paramName" label="参数名称" :disabled="true"></yu-xtable-column>
					<yu-xtable-column prop="paramValue" label="参数值" :disabled="true"></yu-xtable-column>
					<yu-xtable-column prop="remark" label="备注" :disabled="true"></yu-xtable-column>
				</yu-xtable>
			</yu-tab-pane>
			<yu-tab-pane label="作业日志信息" v-if="!updateFlag">
				<yu-input type="textarea" class="forminput" :rows="4" :account="true" placeholder="日志信息" v-model="logText" readonly></yu-input>
			</yu-tab-pane>
			<yu-tab-pane label="作业事件信息" v-if="!updateFlag">
				<yu-xtable row-number selection-type="checkbox" ref="refTableEvents" :pageable="false" :data="useEventLogList" height="410px">
					<yu-xtable-column prop="eventName" ctype="input" label="事件名称" :disabled="true"></yu-xtable-column>
					<yu-xtable-column ctype="select" prop="relation" label="关联关系" data-code="USE_EVT_REL_TYPE" :disabled="true"></yu-xtable-column>
					<yu-xtable-column ctype="input" prop="eventApp" label="事件系统"></yu-xtable-column>
					<yu-xtable-column prop="recordTimeStr" ctype="input" label="事件产生时间" :disabled="true"></yu-xtable-column>
					<yu-xtable-column ctype="input" prop="reamrk" label="备注" :disabled="true"></yu-xtable-column>
				</yu-xtable>
			</yu-tab-pane>
		</yu-tabs>
		<div class="yu-grpButton">
			<yu-button type="primary" @click="jobParamSave" v-if="updateFlag">保存</yu-button>
			<yu-button type="primary" @click="visible = false">关闭</yu-button>
		</div>
	</yu-xdialog>
	<yu-xdialog title="查看设置预置返回值" width="450px" height="140px" :visible.sync="preValueDialogVisible">
		<yu-xform ref="preValueForm" v-model="preValueFormdata" label-width="100px">
			<p style="margin-bottom: 15px; text-align: center; font-size: 12px;">请输入0 ~ 255之间的整数</p>
			<yu-xform-group :column="1">
				<yu-xform-item label="预置返回值" ctype="input" name="returnValue"></yu-xform-item>
			</yu-xform-group>
			<div class="button-group" style="text-align: center">
				<el-button type="primary" @click="setPreValue">保存</el-button>
				<el-button @click="preValueDialogVisible = false">取消</el-button>
			</div>
		</yu-xform>
	</yu-xdialog>
	<yu-xdialog title="修改返回值" width="450px" height="140px" :visible.sync="showModifyRetValue">
		<yu-xform ref="modifyRetForm" v-model="modifyRetValue" label-width="70px">
			<p style="margin-bottom: 15px; text-align: center; font-size: 12px;">请输入0 ~ 255之间的整数</p>
			<yu-xform-group :column="1">
				<yu-xform-item label="返回值" ctype="input" name="returnValue"></yu-xform-item>
			</yu-xform-group>
			<div class="button-group" style="text-align: center">
				<el-button type="primary" @click="setModifyRetValuee">保存</el-button>
				<el-button @click="showModifyRetValue = false">取消</el-button>
			</div>
		</yu-xform>
	</yu-xdialog>
	<yu-xdialog title="修改优先级" width="450px" height="140px" :visible.sync="showJobPriorValue">
		<yu-xform ref="" v-model="jobPriorValue" label-width="70px">
			<p style="margin-bottom: 15px; text-align: center; font-size: 12px;">请输入0 ~ 9之间的整数</p>
			<yu-xform-group :column="1">
				<yu-xform-item label="优先级" ctype="input" name="jobPrior"></yu-xform-item>
			</yu-xform-group>
			<div class="button-group" style="text-align: center">
				<el-button type="primary" @click="setJobPriorValue">保存</el-button>
				<el-button @click="showJobPriorValue = false">取消</el-button>
			</div>
		</yu-xform>
	</yu-xdialog>
	<yu-xdialog title="干预操作状态" width="50%" height="50%" :visible.sync="showDialog" :show-close="false">
		<yu-xtable ref="refLoadTable" row-number :data="loadData" :pageable="false" height="300px">
			<yu-xtable-column label="应用系统" prop="appName"></yu-xtable-column>
			<yu-xtable-column label="任务名称" prop="groupName"></yu-xtable-column>
			<yu-xtable-column label="作业名称" prop="actionName"></yu-xtable-column>
			<yu-xtable-column label="周期时点" prop="cyclePnt"></yu-xtable-column>
			<yu-xtable-column label="操作状态" prop="runState"></yu-xtable-column>
		</yu-xtable>
		<div class="button-group" style="text-align: center">
			<el-button type="primary" @click="closeDialog">关闭</el-button>
		</div>
	</yu-xdialog>



</div>
<style type="text/css">
	.intervalSelectionClass {
		width: 100px;
		height: 20px;
		float: right;
	}

	.formHeight {
		height: 410px;
		overflow-y: auto;
	}

	.forminput textarea {
		height: 410px;
	}
</style>
